Skip to content

Improve SQL Server connection failure diagnostics#1224

Open
ramonsmits wants to merge 1 commit into
mainfrom
improve-sql-diagnostics
Open

Improve SQL Server connection failure diagnostics#1224
ramonsmits wants to merge 1 commit into
mainfrom
improve-sql-diagnostics

Conversation

@ramonsmits

Copy link
Copy Markdown
Member

When the sqlserver command failed to connect, the tool printed the same generic message twice and hid the real SqlException.

  • Print the SqlException Number, State, Class, Server, and message instead of the generic line
  • Echo Data Source / Initial Catalog / Integrated Security (never secrets) before probing
  • Write a redacted diagnostics log file with the full exception chain, also with --unattended
  • Validate --connectionStringSource lines, reporting the 1-based line number on parse failure

Exit codes unchanged.

When the sqlserver command failed to connect, the tool printed the same
generic message twice and hid the real SqlException. Now:

- Surface SqlException Number, State, Class, Server, and all errors in
  the failure message
- Echo the effective connection identity (Data Source, Initial Catalog,
  Integrated Security, Windows identity) before probing, never secrets
- Unwrap HaltException to the innermost exception when printing and
  dedupe repeated messages
- Always write a redacted diagnostics log file (full exception chain,
  Password/PWD blanked) and report wrapped errors, including with
  --unattended
- Harden --connectionStringSource parsing: trim whitespace, strip
  wrapping quotes, and validate each line, reporting the 1-based line
  number on parse failure
@ramonsmits ramonsmits requested a review from mauroservienti July 3, 2026 07:04
@ramonsmits ramonsmits marked this pull request as ready for review July 3, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants